package com.hj.dapp.business.menu.controller;

import com.hj.dapp.business.menu.dto.BindMenuDto;
import com.hj.dapp.business.menu.model.Menu;
import com.hj.dapp.business.menu.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.security.Principal;
import java.util.List;

/**
 * @author 胡奥程
 * @version 1.0
 * @date 2023/12/30
 */
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;
    @PutMapping("/saveMenu")
    public void saveMenu(@RequestBody Menu menu,Principal principal) {
        menuService.saveMenu(menu,principal);
    }

    public List<Menu> getMenuByUser(Principal principal) {
        return menuService.getMenuByUser(principal);
    }
    @GetMapping("/getAllMenu")
    public List<Menu> getAllMenu() {
        return menuService.getAllMenu();
    }

}
